﻿#region 版权信息
// ------------------------------------------------------------------------------
// Copyright: (c) 2029  成都A+有限公司 - Amm
// 项目名称：Amm.Common
// 文件名称：Regex.cs
// 创建时间：202010299:06
// 更改时间：202010299:06
//  ------------------------------------------------------------------------------
#endregion

namespace Colorful.Furniture
{
    /// <summary>
    ///  正则表达式集合
    /// </summary>
    public static class RegexSet
    {
        /// <summary>
        ///     评分等级
        /// </summary>
        public const string EvaluationLevel = @"A|B|C|D|S";

        /// <summary>
        ///     手机号或固定号
        /// </summary>
        public const string PhoneOrTelRegex = @"^(13\d|14[57]|15[^4,\D]|17[3678]|18\d)\d{8}|170[059]\d{7}|(0\d{2,3}-\d{7,8}(-\d{1,4})?)$";

        /// <summary>
        ///   身份证验证
        /// </summary>
        public const string IdCardRegex =
            @"^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$";

        /// <summary>
        ///     手机号码正则表达式（还需限定长度为11）
        /// </summary>
        public const string PhoneNumberRegex = @"(13\d|14[57]|15[^4,\D]|17[3678]|18\d|19[98]|166)\d{8}|170[059]\d{7}";

        /// <summary>
        ///     正数或保留1-4位小数
        /// </summary>
        public const string QuotePriceRegex = "^([1-9]\\d*|0)(\\.\\d{1,4})?$";

        /// <summary>
        ///     0-100整数
        /// </summary>
        public const string ZreoToHundredRegex = @"^100$|^0$|^([1-9]|[1-9]\d)$";

        /// <summary>
        ///     1-100整数
        /// </summary>
        public const string OneToHundrendRegex = @"^[1-9]\d?$|100";

        /// <summary>
        ///     0-100之间的任意数
        /// </summary>
        public const string ZreoToHundredAnyRegex = @"^100$|^(\d|[1-9]\d)(\.\d+)*$";

        /// <summary>
        ///     0到150整数
        /// </summary>
        public const string ZreoTo150Regex = @"^(1[0-4][0-9]|150)$|^([1-9][0-9])$|^[0-9]$";

        /// <summary>
        ///     0到150整数保留1-2位小数（金额类）
        /// </summary>
        public const string ZreoTo150AndSmallRegex = "^(1[0-4][0-9](\\.\\d{1,2})?|^150$)$|^([1-9][0-9])(\\.\\d{1,2})?$|^[0-9](\\.\\d{1,2})?$";

        /// <summary>
        ///     整数
        /// </summary>
        public const string IntegerRegex = @"^\d+$";

        /// <summary>
        ///     正数或保留1-2位小数（金额类）
        /// </summary>
        public const string PriceRegex = "^([1-9]\\d*|0)(\\.\\d{1,4})?$";

        /// <summary>
        ///     正数或保留1-6位小数（金额类）
        /// </summary>
        public const string UnitPriceRegex = "^([1-9]\\d*|0)(\\.\\d{1,6})?$";

        /// <summary>
        ///     用户登录帐号只能数字和字母组合
        /// </summary>
        public const string AccountRegex = @"^[0-9a-zA-Z]*$";

        /// <summary>
        ///     电子邮箱
        /// </summary>
        public const string EmailRegex = @"^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$";

        /// <summary>
        ///     正数，不包括0
        /// </summary>
        public const string PositiveRegex = @"^[1-9]\d*$";

        /// <summary>
        ///     奇数正则表达式(不包含1)
        /// </summary>
        public const string OddMin3Regex = @"^([3579]|[1-9]\d*[13579])$";

        /// <summary>
        ///     奇数正则表达式
        /// </summary>
        public const string OddRegex = @"^([13579]|[1-9]\d*[13579])$";

        /// <summary>
        ///     6位密码正则
        /// </summary>
        public const string PasswordRegex = @"^\d{6}$";

        /// <summary>
        ///     密码
        /// </summary>
        public const string PasswordStrongRegex = "^(?=.{8,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\\W).*$";

        /// <summary>
        ///  图片标签
        /// </summary>
        public const string ImageTagRegex = "<img[^>]+>";
    }
}